import request from "@/utils/request";
import type { CategoryList } from "./model/categoryModel";

enum Api {
  getCategory1List = "/admin/product/getCategory1",
  getCategory2List = "/admin/product/getCategory2",
  getCategory3List = "/admin/product/getCategory3",
}

// 获取一级分类列表
export const getCategory1ListApi = () => {
  return request.get<null, CategoryList>(Api.getCategory1List);
};

// 获取二级分类列表(传入一级分类列表的id)
export const getCategory2ListApi = (category1Id: number) => {
  return request.get<null, CategoryList>(
    `${Api.getCategory2List}/${category1Id}`
  );
};

// 获取三级分类列表(传入二级分类列表的id)
export const getCategory3ListApi = (category2Id: number) => {
  return request.get<null, CategoryList>(
    `${Api.getCategory3List}/${category2Id}`
  );
};
